fmod
Returns the remainder of the floating point number of division
fmod()
function returns the floating point remainder of the division.
In this example, we will use the fmod()
function to return the remainder of 5/2:
<?php $r = fmod ( 5 , 2 ) ; echo $r ?>
Try it yourself
fmod ( x , y )
parameter | describe |
---|---|
x | Required. A number. |
y | Required. A number. |
Returns the floating point remainder obtained by dividing the dividend ( x ) by the divisor ( y ). The remainder (r) is defined as: x = i * y + r, where i is an integer. If y is a non-zero value, the signs of r and x are the same and their number values are less than y .